package pl.iachoo.ctl.tabory.ui;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

import pl.iachoo.ctl.tabory.ui.actions.OpenViewEditorAction;
import pl.iachoo.ctl.tabory.ui.editors.compositions.CompositionEditor;
import pl.iachoo.ctl.tabory.ui.editors.vagons.VagonEditor;
import pl.iachoo.ctl.tabory.ui.properties.Messages;

/**
 * An action bar advisor is responsible for creating, adding, and disposing of
 * the actions added to a workbench window. Each window will be populated with
 * new actions.
 */
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	// private IWorkbenchAction exitAction;
	private OpenViewEditorAction editVagonsAction;
	private OpenViewEditorAction editCompositionsAction;
	// private OpenViewEditorAction editUsersAction;

	public ApplicationActionBarAdvisor(final IActionBarConfigurer configurer) {
		super(configurer);
	}

	@Override
	protected void makeActions(final IWorkbenchWindow window) {
		editVagonsAction = new OpenViewEditorAction(window, "editvagonsview",
				VagonEditor.ID);
		editCompositionsAction = new OpenViewEditorAction(window,
				"editcompositions", CompositionEditor.ID);
		register(editVagonsAction);
		register(editCompositionsAction);
	}

	@Override
	protected void fillMenuBar(final IMenuManager menuBar) {
		final MenuManager editMenu = new MenuManager(
				Messages.getString("menu.submenus.edit"));
		editMenu.add(editVagonsAction);
		editMenu.add(editCompositionsAction);
		menuBar.add(editMenu);
	}

}
